package com.bmft;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

public class EditTextActivity05 extends AppCompatActivity {
    EditText edit_text_05_et_password;
    EditText edit_text_05_et_username;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_edit_text05);
        //find
        edit_text_05_et_username = findViewById(R.id.edit_text_05_et_username);
        edit_text_05_et_password = findViewById(R.id.edit_text_05_et_password);
        //添加监听
        edit_text_05_et_username.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                System.out.println(s);
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });
    }

    /**
     * 点击登录的登录事件
     * @param view
     */
    public void login(View view) {
        Toast.makeText(EditTextActivity05.this, "点击登录，登录验证. ", Toast.LENGTH_SHORT).show();
    }

    /**
     * back to main
     * @param view
     */
    public void edit_text_05_back_to_main(View view) {
        Intent intent = new Intent(EditTextActivity05.this, MainActivity.class);
        startActivity(intent);
    }
}